using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Text;
using Transfer_Object_Tier;

namespace Data_Access_Tier
{
	public class HRM_EMPLOYEEData : DatabaseObjectBase
	{
		public HRM_EMPLOYEEData()
		{
			Initialize(true);
		}
		public HRM_EMPLOYEEData(Boolean newConnection)
		{
			Initialize(newConnection);
		}

        public Int32 HRM_EMPLOYEE_Insert(HRM_EMPLOYEE NHAN_VIEN)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.InsertCommand = new SqlCommand("HRM_EMPLOYEE_Insert");
                _dbadapter.InsertCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.InsertCommand.Connection = _dbconn;
                _trans = _dbconn.BeginTransaction();
                _dbadapter.InsertCommand.Transaction = _trans;
                _dbadapter.InsertCommand.Parameters.Clear();
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BranchCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@DepartmentCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@GroupCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@CandidateCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EnrollNumber", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LastName", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Alias", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Sex", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Marriage", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Birthday", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BirthPlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MainAddress", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContactAddress", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@CellPhone", SqlDbType.NVarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@HomePhone", SqlDbType.NVarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Photo", SqlDbType.Image));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Nationality", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Ethnic", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Religion", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Education", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Language", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Informatic", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Professional", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Position", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@School", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IDCard", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IDCardDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IDCardPlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsTest", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TestTime", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TestFromDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TestToDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@TestSalary", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BeginDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsOffWork", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Health", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Height", SqlDbType.Float));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Weight", SqlDbType.Float));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PayForm", SqlDbType.Int));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PayMoney", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@RankSalary", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@StepSalary", SqlDbType.Int));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@DateSalary", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Allowance1", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Allowance2", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Allowance3", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Allowance4", SqlDbType.Money));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsSocialInsurance", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsHealthInsurance", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsUnemploymentInsurance", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsUnionMoney", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BankCode", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BankDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BankName", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@BankAddress", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LaborCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LaborDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@LaborPlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsUnion", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@UnionCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@UnionDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@UnionPlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@IsParty", SqlDbType.Bit));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PartyCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PartyDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PartyPlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@InsuranceCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@InsuranceDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@InsurancePlace", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@HealthInsuranceCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@HealthInsuranceFromDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@HealthInsuranceToDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContractCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContractType", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContractSignDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContractFromDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@ContractToDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Province", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Hospital", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MilitaryCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MilitaryFromDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MilitaryToDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@MilitaryPosition", SqlDbType.NVarChar, 100));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PassportCode", SqlDbType.VarChar, 20));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PassportFromDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@PassportToDate", SqlDbType.DateTime));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Account", SqlDbType.NVarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50));
                _dbadapter.InsertCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 255));
                _dbadapter.InsertCommand.Prepare();
                SqlString EmployeeCodeSQL = NHAN_VIEN.EmployeeCode;
                _dbadapter.InsertCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
                SqlString BranchCodeSQL = NHAN_VIEN.BranchCode;
                _dbadapter.InsertCommand.Parameters["@BranchCode"].Value = BranchCodeSQL;
                SqlString DepartmentCodeSQL = NHAN_VIEN.DepartmentCode;
                _dbadapter.InsertCommand.Parameters["@DepartmentCode"].Value = DepartmentCodeSQL;
                SqlString GroupCodeSQL = NHAN_VIEN.GroupCode;
                _dbadapter.InsertCommand.Parameters["@GroupCode"].Value = GroupCodeSQL;
                SqlString CandidateCodeSQL = NHAN_VIEN.CandidateCode;
                _dbadapter.InsertCommand.Parameters["@CandidateCode"].Value = CandidateCodeSQL;
                SqlString EnrollNumberSQL = NHAN_VIEN.EnrollNumber;
                _dbadapter.InsertCommand.Parameters["@EnrollNumber"].Value = EnrollNumberSQL;
                SqlString FirstNameSQL = NHAN_VIEN.FirstName;
                _dbadapter.InsertCommand.Parameters["@FirstName"].Value = FirstNameSQL;
                SqlString LastNameSQL = NHAN_VIEN.LastName;
                _dbadapter.InsertCommand.Parameters["@LastName"].Value = LastNameSQL;
                SqlString AliasSQL = NHAN_VIEN.Alias;
                _dbadapter.InsertCommand.Parameters["@Alias"].Value = AliasSQL;
                SqlBoolean SexSQL = NHAN_VIEN.Sex;
                _dbadapter.InsertCommand.Parameters["@Sex"].Value = SexSQL;
                SqlString MarriageSQL = NHAN_VIEN.Marriage;
                _dbadapter.InsertCommand.Parameters["@Marriage"].Value = MarriageSQL;
                SqlDateTime BirthdaySQL = SqlDateTime.Null;
                if (NHAN_VIEN.Birthday > DateTime.MinValue)
                {
                    try
                    {
                        BirthdaySQL = NHAN_VIEN.Birthday;
                    }
                    catch (Exception eBirthday)
                    {
                        String BirthdayMessage = eBirthday.Message;
                        BirthdaySQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@Birthday"].Value = BirthdaySQL;
                SqlString BirthPlaceSQL = NHAN_VIEN.BirthPlace;
                _dbadapter.InsertCommand.Parameters["@BirthPlace"].Value = BirthPlaceSQL;
                SqlString MainAddressSQL = NHAN_VIEN.MainAddress;
                _dbadapter.InsertCommand.Parameters["@MainAddress"].Value = MainAddressSQL;
                SqlString ContactAddressSQL = NHAN_VIEN.ContactAddress;
                _dbadapter.InsertCommand.Parameters["@ContactAddress"].Value = ContactAddressSQL;
                SqlString CellPhoneSQL = NHAN_VIEN.CellPhone;
                _dbadapter.InsertCommand.Parameters["@CellPhone"].Value = CellPhoneSQL;
                SqlString HomePhoneSQL = NHAN_VIEN.HomePhone;
                _dbadapter.InsertCommand.Parameters["@HomePhone"].Value = HomePhoneSQL;
                SqlString EmailSQL = NHAN_VIEN.Email;
                _dbadapter.InsertCommand.Parameters["@Email"].Value = EmailSQL;
                SqlBinary PhotoSQL = NHAN_VIEN.Photo;
                _dbadapter.InsertCommand.Parameters["@Photo"].Value = PhotoSQL;
                SqlString NationalitySQL = NHAN_VIEN.Nationality;
                _dbadapter.InsertCommand.Parameters["@Nationality"].Value = NationalitySQL;
                SqlString EthnicSQL = NHAN_VIEN.Ethnic;
                _dbadapter.InsertCommand.Parameters["@Ethnic"].Value = EthnicSQL;
                SqlString ReligionSQL = NHAN_VIEN.Religion;
                _dbadapter.InsertCommand.Parameters["@Religion"].Value = ReligionSQL;
                SqlString EducationSQL = NHAN_VIEN.Education;
                _dbadapter.InsertCommand.Parameters["@Education"].Value = EducationSQL;
                SqlString LanguageSQL = NHAN_VIEN.Language;
                _dbadapter.InsertCommand.Parameters["@Language"].Value = LanguageSQL;
                SqlString InformaticSQL = NHAN_VIEN.Informatic;
                _dbadapter.InsertCommand.Parameters["@Informatic"].Value = InformaticSQL;
                SqlString ProfessionalSQL = NHAN_VIEN.Professional;
                _dbadapter.InsertCommand.Parameters["@Professional"].Value = ProfessionalSQL;
                SqlString PositionSQL = NHAN_VIEN.Position;
                _dbadapter.InsertCommand.Parameters["@Position"].Value = PositionSQL;
                SqlString SchoolSQL = NHAN_VIEN.School;
                _dbadapter.InsertCommand.Parameters["@School"].Value = SchoolSQL;
                SqlString IDCardSQL = NHAN_VIEN.IDCard;
                _dbadapter.InsertCommand.Parameters["@IDCard"].Value = IDCardSQL;
                SqlDateTime IDCardDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.IDCardDate > DateTime.MinValue)
                {
                    try
                    {
                        IDCardDateSQL = NHAN_VIEN.IDCardDate;
                    }
                    catch (Exception eIDCardDate)
                    {
                        String IDCardDateMessage = eIDCardDate.Message;
                        IDCardDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@IDCardDate"].Value = IDCardDateSQL;
                SqlString IDCardPlaceSQL = NHAN_VIEN.IDCardPlace;
                _dbadapter.InsertCommand.Parameters["@IDCardPlace"].Value = IDCardPlaceSQL;
                SqlBoolean IsTestSQL = NHAN_VIEN.IsTest;
                _dbadapter.InsertCommand.Parameters["@IsTest"].Value = IsTestSQL;
                SqlString TestTimeSQL = NHAN_VIEN.TestTime;
                _dbadapter.InsertCommand.Parameters["@TestTime"].Value = TestTimeSQL;
                SqlDateTime TestFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.TestFromDate > DateTime.MinValue)
                {
                    try
                    {
                        TestFromDateSQL = NHAN_VIEN.TestFromDate;
                    }
                    catch (Exception eTestFromDate)
                    {
                        String TestFromDateMessage = eTestFromDate.Message;
                        TestFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@TestFromDate"].Value = TestFromDateSQL;
                SqlDateTime TestToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.TestToDate > DateTime.MinValue)
                {
                    try
                    {
                        TestToDateSQL = NHAN_VIEN.TestToDate;
                    }
                    catch (Exception eTestToDate)
                    {
                        String TestToDateMessage = eTestToDate.Message;
                        TestToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@TestToDate"].Value = TestToDateSQL;
                SqlMoney TestSalarySQL = NHAN_VIEN.TestSalary;
                _dbadapter.InsertCommand.Parameters["@TestSalary"].Value = TestSalarySQL;
                SqlDateTime BeginDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.BeginDate > DateTime.MinValue)
                {
                    try
                    {
                        BeginDateSQL = NHAN_VIEN.BeginDate;
                    }
                    catch (Exception eBeginDate)
                    {
                        String BeginDateMessage = eBeginDate.Message;
                        BeginDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@BeginDate"].Value = BeginDateSQL;
                SqlBoolean IsOffWorkSQL = NHAN_VIEN.IsOffWork;
                _dbadapter.InsertCommand.Parameters["@IsOffWork"].Value = IsOffWorkSQL;
                SqlDateTime EndDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.EndDate > DateTime.MinValue)
                {
                    try
                    {
                        EndDateSQL = NHAN_VIEN.EndDate;
                    }
                    catch (Exception eEndDate)
                    {
                        String EndDateMessage = eEndDate.Message;
                        EndDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@EndDate"].Value = EndDateSQL;
                SqlString HealthSQL = NHAN_VIEN.Health;
                _dbadapter.InsertCommand.Parameters["@Health"].Value = HealthSQL;
                SqlDouble HeightSQL = NHAN_VIEN.Height;
                _dbadapter.InsertCommand.Parameters["@Height"].Value = HeightSQL;
                SqlDouble WeightSQL = NHAN_VIEN.Weight;
                _dbadapter.InsertCommand.Parameters["@Weight"].Value = WeightSQL;
                SqlInt32 PayFormSQL = NHAN_VIEN.PayForm;
                _dbadapter.InsertCommand.Parameters["@PayForm"].Value = PayFormSQL;
                SqlMoney PayMoneySQL = NHAN_VIEN.PayMoney;
                _dbadapter.InsertCommand.Parameters["@PayMoney"].Value = PayMoneySQL;
                SqlMoney MinimumSalarySQL = NHAN_VIEN.MinimumSalary;
                _dbadapter.InsertCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
                SqlString RankSalarySQL = NHAN_VIEN.RankSalary;
                _dbadapter.InsertCommand.Parameters["@RankSalary"].Value = RankSalarySQL;
                SqlInt32 StepSalarySQL = NHAN_VIEN.StepSalary;
                _dbadapter.InsertCommand.Parameters["@StepSalary"].Value = StepSalarySQL;
                SqlDouble CoefficientSalarySQL = NHAN_VIEN.CoefficientSalary;
                _dbadapter.InsertCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
                SqlDateTime DateSalarySQL = SqlDateTime.Null;
                if (NHAN_VIEN.DateSalary > DateTime.MinValue)
                {
                    try
                    {
                        DateSalarySQL = NHAN_VIEN.DateSalary;
                    }
                    catch (Exception eDateSalary)
                    {
                        String DateSalaryMessage = eDateSalary.Message;
                        DateSalarySQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@DateSalary"].Value = DateSalarySQL;
                SqlMoney BasicSalarySQL = NHAN_VIEN.BasicSalary;
                _dbadapter.InsertCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
                SqlMoney InsuranceSalarySQL = NHAN_VIEN.InsuranceSalary;
                _dbadapter.InsertCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
                SqlMoney Allowance1SQL = NHAN_VIEN.Allowance1;
                _dbadapter.InsertCommand.Parameters["@Allowance1"].Value = Allowance1SQL;
                SqlMoney Allowance2SQL = NHAN_VIEN.Allowance2;
                _dbadapter.InsertCommand.Parameters["@Allowance2"].Value = Allowance2SQL;
                SqlMoney Allowance3SQL = NHAN_VIEN.Allowance3;
                _dbadapter.InsertCommand.Parameters["@Allowance3"].Value = Allowance3SQL;
                SqlMoney Allowance4SQL = NHAN_VIEN.Allowance4;
                _dbadapter.InsertCommand.Parameters["@Allowance4"].Value = Allowance4SQL;
                SqlBoolean IsSocialInsuranceSQL = NHAN_VIEN.IsSocialInsurance;
                _dbadapter.InsertCommand.Parameters["@IsSocialInsurance"].Value = IsSocialInsuranceSQL;
                SqlBoolean IsHealthInsuranceSQL = NHAN_VIEN.IsHealthInsurance;
                _dbadapter.InsertCommand.Parameters["@IsHealthInsurance"].Value = IsHealthInsuranceSQL;
                SqlBoolean IsUnemploymentInsuranceSQL = NHAN_VIEN.IsUnemploymentInsurance;
                _dbadapter.InsertCommand.Parameters["@IsUnemploymentInsurance"].Value = IsUnemploymentInsuranceSQL;
                SqlBoolean IsUnionMoneySQL = NHAN_VIEN.IsUnionMoney;
                _dbadapter.InsertCommand.Parameters["@IsUnionMoney"].Value = IsUnionMoneySQL;
                SqlString BankCodeSQL = NHAN_VIEN.BankCode;
                _dbadapter.InsertCommand.Parameters["@BankCode"].Value = BankCodeSQL;
                SqlDateTime BankDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.BankDate > DateTime.MinValue)
                {
                    try
                    {
                        BankDateSQL = NHAN_VIEN.BankDate;
                    }
                    catch (Exception eBankDate)
                    {
                        String BankDateMessage = eBankDate.Message;
                        BankDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@BankDate"].Value = BankDateSQL;
                SqlString BankNameSQL = NHAN_VIEN.BankName;
                _dbadapter.InsertCommand.Parameters["@BankName"].Value = BankNameSQL;
                SqlString BankAddressSQL = NHAN_VIEN.BankAddress;
                _dbadapter.InsertCommand.Parameters["@BankAddress"].Value = BankAddressSQL;
                SqlString LaborCodeSQL = NHAN_VIEN.LaborCode;
                _dbadapter.InsertCommand.Parameters["@LaborCode"].Value = LaborCodeSQL;
                SqlDateTime LaborDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.LaborDate > DateTime.MinValue)
                {
                    try
                    {
                        LaborDateSQL = NHAN_VIEN.LaborDate;
                    }
                    catch (Exception eLaborDate)
                    {
                        String LaborDateMessage = eLaborDate.Message;
                        LaborDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@LaborDate"].Value = LaborDateSQL;
                SqlString LaborPlaceSQL = NHAN_VIEN.LaborPlace;
                _dbadapter.InsertCommand.Parameters["@LaborPlace"].Value = LaborPlaceSQL;
                SqlBoolean IsUnionSQL = NHAN_VIEN.IsUnion;
                _dbadapter.InsertCommand.Parameters["@IsUnion"].Value = IsUnionSQL;
                SqlString UnionCodeSQL = NHAN_VIEN.UnionCode;
                _dbadapter.InsertCommand.Parameters["@UnionCode"].Value = UnionCodeSQL;
                SqlDateTime UnionDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.UnionDate > DateTime.MinValue)
                {
                    try
                    {
                        UnionDateSQL = NHAN_VIEN.UnionDate;
                    }
                    catch (Exception eUnionDate)
                    {
                        String UnionDateMessage = eUnionDate.Message;
                        UnionDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@UnionDate"].Value = UnionDateSQL;
                SqlString UnionPlaceSQL = NHAN_VIEN.UnionPlace;
                _dbadapter.InsertCommand.Parameters["@UnionPlace"].Value = UnionPlaceSQL;
                SqlBoolean IsPartySQL = NHAN_VIEN.IsParty;
                _dbadapter.InsertCommand.Parameters["@IsParty"].Value = IsPartySQL;
                SqlString PartyCodeSQL = NHAN_VIEN.PartyCode;
                _dbadapter.InsertCommand.Parameters["@PartyCode"].Value = PartyCodeSQL;
                SqlDateTime PartyDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PartyDate > DateTime.MinValue)
                {
                    try
                    {
                        PartyDateSQL = NHAN_VIEN.PartyDate;
                    }
                    catch (Exception ePartyDate)
                    {
                        String PartyDateMessage = ePartyDate.Message;
                        PartyDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@PartyDate"].Value = PartyDateSQL;
                SqlString PartyPlaceSQL = NHAN_VIEN.PartyPlace;
                _dbadapter.InsertCommand.Parameters["@PartyPlace"].Value = PartyPlaceSQL;
                SqlString InsuranceCodeSQL = NHAN_VIEN.InsuranceCode;
                _dbadapter.InsertCommand.Parameters["@InsuranceCode"].Value = InsuranceCodeSQL;
                SqlDateTime InsuranceDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.InsuranceDate > DateTime.MinValue)
                {
                    try
                    {
                        InsuranceDateSQL = NHAN_VIEN.InsuranceDate;
                    }
                    catch (Exception eInsuranceDate)
                    {
                        String InsuranceDateMessage = eInsuranceDate.Message;
                        InsuranceDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@InsuranceDate"].Value = InsuranceDateSQL;
                SqlString InsurancePlaceSQL = NHAN_VIEN.InsurancePlace;
                _dbadapter.InsertCommand.Parameters["@InsurancePlace"].Value = InsurancePlaceSQL;
                SqlString HealthInsuranceCodeSQL = NHAN_VIEN.HealthInsuranceCode;
                _dbadapter.InsertCommand.Parameters["@HealthInsuranceCode"].Value = HealthInsuranceCodeSQL;
                SqlDateTime HealthInsuranceFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.HealthInsuranceFromDate > DateTime.MinValue)
                {
                    try
                    {
                        HealthInsuranceFromDateSQL = NHAN_VIEN.HealthInsuranceFromDate;
                    }
                    catch (Exception eHealthInsuranceFromDate)
                    {
                        String HealthInsuranceFromDateMessage = eHealthInsuranceFromDate.Message;
                        HealthInsuranceFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@HealthInsuranceFromDate"].Value = HealthInsuranceFromDateSQL;
                SqlDateTime HealthInsuranceToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.HealthInsuranceToDate > DateTime.MinValue)
                {
                    try
                    {
                        HealthInsuranceToDateSQL = NHAN_VIEN.HealthInsuranceToDate;
                    }
                    catch (Exception eHealthInsuranceToDate)
                    {
                        String HealthInsuranceToDateMessage = eHealthInsuranceToDate.Message;
                        HealthInsuranceToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@HealthInsuranceToDate"].Value = HealthInsuranceToDateSQL;
                SqlString ContractCodeSQL = NHAN_VIEN.ContractCode;
                _dbadapter.InsertCommand.Parameters["@ContractCode"].Value = ContractCodeSQL;
                SqlString ContractTypeSQL = NHAN_VIEN.ContractType;
                _dbadapter.InsertCommand.Parameters["@ContractType"].Value = ContractTypeSQL;
                SqlDateTime ContractSignDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractSignDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractSignDateSQL = NHAN_VIEN.ContractSignDate;
                    }
                    catch (Exception eContractSignDate)
                    {
                        String ContractSignDateMessage = eContractSignDate.Message;
                        ContractSignDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@ContractSignDate"].Value = ContractSignDateSQL;
                SqlDateTime ContractFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractFromDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractFromDateSQL = NHAN_VIEN.ContractFromDate;
                    }
                    catch (Exception eContractFromDate)
                    {
                        String ContractFromDateMessage = eContractFromDate.Message;
                        ContractFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@ContractFromDate"].Value = ContractFromDateSQL;
                SqlDateTime ContractToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractToDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractToDateSQL = NHAN_VIEN.ContractToDate;
                    }
                    catch (Exception eContractToDate)
                    {
                        String ContractToDateMessage = eContractToDate.Message;
                        ContractToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@ContractToDate"].Value = ContractToDateSQL;
                SqlString ProvinceSQL = NHAN_VIEN.Province;
                _dbadapter.InsertCommand.Parameters["@Province"].Value = ProvinceSQL;
                SqlString HospitalSQL = NHAN_VIEN.Hospital;
                _dbadapter.InsertCommand.Parameters["@Hospital"].Value = HospitalSQL;
                SqlString MilitaryCodeSQL = NHAN_VIEN.MilitaryCode;
                _dbadapter.InsertCommand.Parameters["@MilitaryCode"].Value = MilitaryCodeSQL;
                SqlDateTime MilitaryFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.MilitaryFromDate > DateTime.MinValue)
                {
                    try
                    {
                        MilitaryFromDateSQL = NHAN_VIEN.MilitaryFromDate;
                    }
                    catch (Exception eMilitaryFromDate)
                    {
                        String MilitaryFromDateMessage = eMilitaryFromDate.Message;
                        MilitaryFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@MilitaryFromDate"].Value = MilitaryFromDateSQL;
                SqlDateTime MilitaryToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.MilitaryToDate > DateTime.MinValue)
                {
                    try
                    {
                        MilitaryToDateSQL = NHAN_VIEN.MilitaryToDate;
                    }
                    catch (Exception eMilitaryToDate)
                    {
                        String MilitaryToDateMessage = eMilitaryToDate.Message;
                        MilitaryToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@MilitaryToDate"].Value = MilitaryToDateSQL;
                SqlString MilitaryPositionSQL = NHAN_VIEN.MilitaryPosition;
                _dbadapter.InsertCommand.Parameters["@MilitaryPosition"].Value = MilitaryPositionSQL;
                SqlString PassportCodeSQL = NHAN_VIEN.PassportCode;
                _dbadapter.InsertCommand.Parameters["@PassportCode"].Value = PassportCodeSQL;
                SqlDateTime PassportFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PassportFromDate > DateTime.MinValue)
                {
                    try
                    {
                        PassportFromDateSQL = NHAN_VIEN.PassportFromDate;
                    }
                    catch (Exception ePassportFromDate)
                    {
                        String PassportFromDateMessage = ePassportFromDate.Message;
                        PassportFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@PassportFromDate"].Value = PassportFromDateSQL;
                SqlDateTime PassportToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PassportToDate > DateTime.MinValue)
                {
                    try
                    {
                        PassportToDateSQL = NHAN_VIEN.PassportToDate;
                    }
                    catch (Exception ePassportToDate)
                    {
                        String PassportToDateMessage = ePassportToDate.Message;
                        PassportToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.InsertCommand.Parameters["@PassportToDate"].Value = PassportToDateSQL;
                SqlInt32 StatusSQL = NHAN_VIEN.Status;
                _dbadapter.InsertCommand.Parameters["@Status"].Value = StatusSQL;
                SqlString AccountSQL = NHAN_VIEN.Account;
                _dbadapter.InsertCommand.Parameters["@Account"].Value = AccountSQL;
                SqlString PasswordSQL = NHAN_VIEN.Password;
                _dbadapter.InsertCommand.Parameters["@Password"].Value = PasswordSQL;
                SqlString DescriptionSQL = NHAN_VIEN.Description;
                _dbadapter.InsertCommand.Parameters["@Description"].Value = DescriptionSQL;
                Int32 returnvalue = Convert.ToInt32(_dbadapter.InsertCommand.ExecuteScalar());

                _trans.Commit();
                return returnvalue;
            }
            catch (SqlException e)
            {
                try
                {
                    _trans.Rollback();
                }
                catch (SqlException ex)
                {
                    throw new Exception("SQL Rollback Error: HRM_EMPLOYEE_Insert: " + ex.Message, ex);
                }
                throw new Exception("SQL Error: HRM_EMPLOYEE_Insert: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.InsertCommand != null)
                    _dbadapter.InsertCommand.Dispose();
                CloseConnection();
            }
        }
		public Int32 HRM_EMPLOYEE_Update(HRM_EMPLOYEE NHAN_VIEN)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_EMPLOYEE_Update");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BranchCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DepartmentCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CandidateCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EnrollNumber", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LastName", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Alias", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Sex", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Marriage", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Birthday", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BirthPlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MainAddress", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContactAddress", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CellPhone", SqlDbType.NVarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HomePhone", SqlDbType.NVarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Photo", SqlDbType.Image));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Nationality", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Ethnic", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Religion", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Education", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Language", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Informatic", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Professional", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Position", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@School", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCard", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCardDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCardPlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsTest", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestTime", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestFromDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestToDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestSalary", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BeginDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsOffWork", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Health", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Height", SqlDbType.Float));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Weight", SqlDbType.Float));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PayForm", SqlDbType.Int));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PayMoney", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@RankSalary", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@StepSalary", SqlDbType.Int));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DateSalary", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance1", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance2", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance3", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance4", SqlDbType.Money));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsSocialInsurance", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsHealthInsurance", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnemploymentInsurance", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnionMoney", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankCode", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankName", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankAddress", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborPlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnion", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionPlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsParty", SqlDbType.Bit));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyPlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsurancePlace", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceFromDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceToDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractType", SqlDbType.NVarChar, 255));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractSignDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractFromDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractToDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Province", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Hospital", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryFromDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryToDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryPosition", SqlDbType.NVarChar, 100));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportCode", SqlDbType.VarChar, 20));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportFromDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportToDate", SqlDbType.DateTime));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Account", SqlDbType.NVarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50));
                _dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 255));

                _dbadapter.UpdateCommand.Prepare();
                SqlString EmployeeCodeSQL = NHAN_VIEN.EmployeeCode;
                _dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
                SqlString BranchCodeSQL = NHAN_VIEN.BranchCode;
                _dbadapter.UpdateCommand.Parameters["@BranchCode"].Value = BranchCodeSQL;
                SqlString DepartmentCodeSQL = NHAN_VIEN.DepartmentCode;
                _dbadapter.UpdateCommand.Parameters["@DepartmentCode"].Value = DepartmentCodeSQL;
                SqlString GroupCodeSQL = NHAN_VIEN.GroupCode;
                _dbadapter.UpdateCommand.Parameters["@GroupCode"].Value = GroupCodeSQL;
                SqlString CandidateCodeSQL = NHAN_VIEN.CandidateCode;
                _dbadapter.UpdateCommand.Parameters["@CandidateCode"].Value = CandidateCodeSQL;
                SqlString EnrollNumberSQL = NHAN_VIEN.EnrollNumber;
                _dbadapter.UpdateCommand.Parameters["@EnrollNumber"].Value = EnrollNumberSQL;
                SqlString FirstNameSQL = NHAN_VIEN.FirstName;
                _dbadapter.UpdateCommand.Parameters["@FirstName"].Value = FirstNameSQL;
                SqlString LastNameSQL = NHAN_VIEN.LastName;
                _dbadapter.UpdateCommand.Parameters["@LastName"].Value = LastNameSQL;
                SqlString AliasSQL = NHAN_VIEN.Alias;
                _dbadapter.UpdateCommand.Parameters["@Alias"].Value = AliasSQL;
                SqlBoolean SexSQL = NHAN_VIEN.Sex;
                _dbadapter.UpdateCommand.Parameters["@Sex"].Value = SexSQL;
                SqlString MarriageSQL = NHAN_VIEN.Marriage;
                _dbadapter.UpdateCommand.Parameters["@Marriage"].Value = MarriageSQL;
                SqlDateTime BirthdaySQL = SqlDateTime.Null;
                if (NHAN_VIEN.Birthday > DateTime.MinValue)
                {
                    try
                    {
                        BirthdaySQL = NHAN_VIEN.Birthday;
                    }
                    catch (Exception eBirthday)
                    {
                        String BirthdayMessage = eBirthday.Message;
                        BirthdaySQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@Birthday"].Value = BirthdaySQL;
                SqlString BirthPlaceSQL = NHAN_VIEN.BirthPlace;
                _dbadapter.UpdateCommand.Parameters["@BirthPlace"].Value = BirthPlaceSQL;
                SqlString MainAddressSQL = NHAN_VIEN.MainAddress;
                _dbadapter.UpdateCommand.Parameters["@MainAddress"].Value = MainAddressSQL;
                SqlString ContactAddressSQL = NHAN_VIEN.ContactAddress;
                _dbadapter.UpdateCommand.Parameters["@ContactAddress"].Value = ContactAddressSQL;
                SqlString CellPhoneSQL = NHAN_VIEN.CellPhone;
                _dbadapter.UpdateCommand.Parameters["@CellPhone"].Value = CellPhoneSQL;
                SqlString HomePhoneSQL = NHAN_VIEN.HomePhone;
                _dbadapter.UpdateCommand.Parameters["@HomePhone"].Value = HomePhoneSQL;
                SqlString EmailSQL = NHAN_VIEN.Email;
                _dbadapter.UpdateCommand.Parameters["@Email"].Value = EmailSQL;
                SqlBinary PhotoSQL = NHAN_VIEN.Photo;
                _dbadapter.UpdateCommand.Parameters["@Photo"].Value = PhotoSQL;
                SqlString NationalitySQL = NHAN_VIEN.Nationality;
                _dbadapter.UpdateCommand.Parameters["@Nationality"].Value = NationalitySQL;
                SqlString EthnicSQL = NHAN_VIEN.Ethnic;
                _dbadapter.UpdateCommand.Parameters["@Ethnic"].Value = EthnicSQL;
                SqlString ReligionSQL = NHAN_VIEN.Religion;
                _dbadapter.UpdateCommand.Parameters["@Religion"].Value = ReligionSQL;
                SqlString EducationSQL = NHAN_VIEN.Education;
                _dbadapter.UpdateCommand.Parameters["@Education"].Value = EducationSQL;
                SqlString LanguageSQL = NHAN_VIEN.Language;
                _dbadapter.UpdateCommand.Parameters["@Language"].Value = LanguageSQL;
                SqlString InformaticSQL = NHAN_VIEN.Informatic;
                _dbadapter.UpdateCommand.Parameters["@Informatic"].Value = InformaticSQL;
                SqlString ProfessionalSQL = NHAN_VIEN.Professional;
                _dbadapter.UpdateCommand.Parameters["@Professional"].Value = ProfessionalSQL;
                SqlString PositionSQL = NHAN_VIEN.Position;
                _dbadapter.UpdateCommand.Parameters["@Position"].Value = PositionSQL;
                SqlString SchoolSQL = NHAN_VIEN.School;
                _dbadapter.UpdateCommand.Parameters["@School"].Value = SchoolSQL;
                SqlString IDCardSQL = NHAN_VIEN.IDCard;
                _dbadapter.UpdateCommand.Parameters["@IDCard"].Value = IDCardSQL;
                SqlDateTime IDCardDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.IDCardDate > DateTime.MinValue)
                {
                    try
                    {
                        IDCardDateSQL = NHAN_VIEN.IDCardDate;
                    }
                    catch (Exception eIDCardDate)
                    {
                        String IDCardDateMessage = eIDCardDate.Message;
                        IDCardDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@IDCardDate"].Value = IDCardDateSQL;
                SqlString IDCardPlaceSQL = NHAN_VIEN.IDCardPlace;
                _dbadapter.UpdateCommand.Parameters["@IDCardPlace"].Value = IDCardPlaceSQL;
                SqlBoolean IsTestSQL = NHAN_VIEN.IsTest;
                _dbadapter.UpdateCommand.Parameters["@IsTest"].Value = IsTestSQL;
                SqlString TestTimeSQL = NHAN_VIEN.TestTime;
                _dbadapter.UpdateCommand.Parameters["@TestTime"].Value = TestTimeSQL;
                SqlDateTime TestFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.TestFromDate > DateTime.MinValue)
                {
                    try
                    {
                        TestFromDateSQL = NHAN_VIEN.TestFromDate;
                    }
                    catch (Exception eTestFromDate)
                    {
                        String TestFromDateMessage = eTestFromDate.Message;
                        TestFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@TestFromDate"].Value = TestFromDateSQL;
                SqlDateTime TestToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.TestToDate > DateTime.MinValue)
                {
                    try
                    {
                        TestToDateSQL = NHAN_VIEN.TestToDate;
                    }
                    catch (Exception eTestToDate)
                    {
                        String TestToDateMessage = eTestToDate.Message;
                        TestToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@TestToDate"].Value = TestToDateSQL;
                SqlMoney TestSalarySQL = NHAN_VIEN.TestSalary;
                _dbadapter.UpdateCommand.Parameters["@TestSalary"].Value = TestSalarySQL;
                SqlDateTime BeginDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.BeginDate > DateTime.MinValue)
                {
                    try
                    {
                        BeginDateSQL = NHAN_VIEN.BeginDate;
                    }
                    catch (Exception eBeginDate)
                    {
                        String BeginDateMessage = eBeginDate.Message;
                        BeginDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@BeginDate"].Value = BeginDateSQL;
                SqlBoolean IsOffWorkSQL = NHAN_VIEN.IsOffWork;
                _dbadapter.UpdateCommand.Parameters["@IsOffWork"].Value = IsOffWorkSQL;
                SqlDateTime EndDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.EndDate > DateTime.MinValue)
                {
                    try
                    {
                        EndDateSQL = NHAN_VIEN.EndDate;
                    }
                    catch (Exception eEndDate)
                    {
                        String EndDateMessage = eEndDate.Message;
                        EndDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@EndDate"].Value = EndDateSQL;
                SqlString HealthSQL = NHAN_VIEN.Health;
                _dbadapter.UpdateCommand.Parameters["@Health"].Value = HealthSQL;
                SqlDouble HeightSQL = NHAN_VIEN.Height;
                _dbadapter.UpdateCommand.Parameters["@Height"].Value = HeightSQL;
                SqlDouble WeightSQL = NHAN_VIEN.Weight;
                _dbadapter.UpdateCommand.Parameters["@Weight"].Value = WeightSQL;
                SqlInt32 PayFormSQL = NHAN_VIEN.PayForm;
                _dbadapter.UpdateCommand.Parameters["@PayForm"].Value = PayFormSQL;
                SqlMoney PayMoneySQL = NHAN_VIEN.PayMoney;
                _dbadapter.UpdateCommand.Parameters["@PayMoney"].Value = PayMoneySQL;
                SqlMoney MinimumSalarySQL = NHAN_VIEN.MinimumSalary;
                _dbadapter.UpdateCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
                SqlString RankSalarySQL = NHAN_VIEN.RankSalary;
                _dbadapter.UpdateCommand.Parameters["@RankSalary"].Value = RankSalarySQL;
                SqlInt32 StepSalarySQL = NHAN_VIEN.StepSalary;
                _dbadapter.UpdateCommand.Parameters["@StepSalary"].Value = StepSalarySQL;
                SqlDouble CoefficientSalarySQL = NHAN_VIEN.CoefficientSalary;
                _dbadapter.UpdateCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
                SqlDateTime DateSalarySQL = SqlDateTime.Null;
                if (NHAN_VIEN.DateSalary > DateTime.MinValue)
                {
                    try
                    {
                        DateSalarySQL = NHAN_VIEN.DateSalary;
                    }
                    catch (Exception eDateSalary)
                    {
                        String DateSalaryMessage = eDateSalary.Message;
                        DateSalarySQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@DateSalary"].Value = DateSalarySQL;
                SqlMoney BasicSalarySQL = NHAN_VIEN.BasicSalary;
                _dbadapter.UpdateCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
                SqlMoney InsuranceSalarySQL = NHAN_VIEN.InsuranceSalary;
                _dbadapter.UpdateCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
                SqlMoney Allowance1SQL = NHAN_VIEN.Allowance1;
                _dbadapter.UpdateCommand.Parameters["@Allowance1"].Value = Allowance1SQL;
                SqlMoney Allowance2SQL = NHAN_VIEN.Allowance2;
                _dbadapter.UpdateCommand.Parameters["@Allowance2"].Value = Allowance2SQL;
                SqlMoney Allowance3SQL = NHAN_VIEN.Allowance3;
                _dbadapter.UpdateCommand.Parameters["@Allowance3"].Value = Allowance3SQL;
                SqlMoney Allowance4SQL = NHAN_VIEN.Allowance4;
                _dbadapter.UpdateCommand.Parameters["@Allowance4"].Value = Allowance4SQL;
                SqlBoolean IsSocialInsuranceSQL = NHAN_VIEN.IsSocialInsurance;
                _dbadapter.UpdateCommand.Parameters["@IsSocialInsurance"].Value = IsSocialInsuranceSQL;
                SqlBoolean IsHealthInsuranceSQL = NHAN_VIEN.IsHealthInsurance;
                _dbadapter.UpdateCommand.Parameters["@IsHealthInsurance"].Value = IsHealthInsuranceSQL;
                SqlBoolean IsUnemploymentInsuranceSQL = NHAN_VIEN.IsUnemploymentInsurance;
                _dbadapter.UpdateCommand.Parameters["@IsUnemploymentInsurance"].Value = IsUnemploymentInsuranceSQL;
                SqlBoolean IsUnionMoneySQL = NHAN_VIEN.IsUnionMoney;
                _dbadapter.UpdateCommand.Parameters["@IsUnionMoney"].Value = IsUnionMoneySQL;
                SqlString BankCodeSQL = NHAN_VIEN.BankCode;
                _dbadapter.UpdateCommand.Parameters["@BankCode"].Value = BankCodeSQL;
                SqlDateTime BankDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.BankDate > DateTime.MinValue)
                {
                    try
                    {
                        BankDateSQL = NHAN_VIEN.BankDate;
                    }
                    catch (Exception eBankDate)
                    {
                        String BankDateMessage = eBankDate.Message;
                        BankDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@BankDate"].Value = BankDateSQL;
                SqlString BankNameSQL = NHAN_VIEN.BankName;
                _dbadapter.UpdateCommand.Parameters["@BankName"].Value = BankNameSQL;
                SqlString BankAddressSQL = NHAN_VIEN.BankAddress;
                _dbadapter.UpdateCommand.Parameters["@BankAddress"].Value = BankAddressSQL;
                SqlString LaborCodeSQL = NHAN_VIEN.LaborCode;
                _dbadapter.UpdateCommand.Parameters["@LaborCode"].Value = LaborCodeSQL;
                SqlDateTime LaborDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.LaborDate > DateTime.MinValue)
                {
                    try
                    {
                        LaborDateSQL = NHAN_VIEN.LaborDate;
                    }
                    catch (Exception eLaborDate)
                    {
                        String LaborDateMessage = eLaborDate.Message;
                        LaborDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@LaborDate"].Value = LaborDateSQL;
                SqlString LaborPlaceSQL = NHAN_VIEN.LaborPlace;
                _dbadapter.UpdateCommand.Parameters["@LaborPlace"].Value = LaborPlaceSQL;
                SqlBoolean IsUnionSQL = NHAN_VIEN.IsUnion;
                _dbadapter.UpdateCommand.Parameters["@IsUnion"].Value = IsUnionSQL;
                SqlString UnionCodeSQL = NHAN_VIEN.UnionCode;
                _dbadapter.UpdateCommand.Parameters["@UnionCode"].Value = UnionCodeSQL;
                SqlDateTime UnionDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.UnionDate > DateTime.MinValue)
                {
                    try
                    {
                        UnionDateSQL = NHAN_VIEN.UnionDate;
                    }
                    catch (Exception eUnionDate)
                    {
                        String UnionDateMessage = eUnionDate.Message;
                        UnionDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@UnionDate"].Value = UnionDateSQL;
                SqlString UnionPlaceSQL = NHAN_VIEN.UnionPlace;
                _dbadapter.UpdateCommand.Parameters["@UnionPlace"].Value = UnionPlaceSQL;
                SqlBoolean IsPartySQL = NHAN_VIEN.IsParty;
                _dbadapter.UpdateCommand.Parameters["@IsParty"].Value = IsPartySQL;
                SqlString PartyCodeSQL = NHAN_VIEN.PartyCode;
                _dbadapter.UpdateCommand.Parameters["@PartyCode"].Value = PartyCodeSQL;
                SqlDateTime PartyDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PartyDate > DateTime.MinValue)
                {
                    try
                    {
                        PartyDateSQL = NHAN_VIEN.PartyDate;
                    }
                    catch (Exception ePartyDate)
                    {
                        String PartyDateMessage = ePartyDate.Message;
                        PartyDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@PartyDate"].Value = PartyDateSQL;
                SqlString PartyPlaceSQL = NHAN_VIEN.PartyPlace;
                _dbadapter.UpdateCommand.Parameters["@PartyPlace"].Value = PartyPlaceSQL;
                SqlString InsuranceCodeSQL = NHAN_VIEN.InsuranceCode;
                _dbadapter.UpdateCommand.Parameters["@InsuranceCode"].Value = InsuranceCodeSQL;
                SqlDateTime InsuranceDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.InsuranceDate > DateTime.MinValue)
                {
                    try
                    {
                        InsuranceDateSQL = NHAN_VIEN.InsuranceDate;
                    }
                    catch (Exception eInsuranceDate)
                    {
                        String InsuranceDateMessage = eInsuranceDate.Message;
                        InsuranceDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@InsuranceDate"].Value = InsuranceDateSQL;
                SqlString InsurancePlaceSQL = NHAN_VIEN.InsurancePlace;
                _dbadapter.UpdateCommand.Parameters["@InsurancePlace"].Value = InsurancePlaceSQL;
                SqlString HealthInsuranceCodeSQL = NHAN_VIEN.HealthInsuranceCode;
                _dbadapter.UpdateCommand.Parameters["@HealthInsuranceCode"].Value = HealthInsuranceCodeSQL;
                SqlDateTime HealthInsuranceFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.HealthInsuranceFromDate > DateTime.MinValue)
                {
                    try
                    {
                        HealthInsuranceFromDateSQL = NHAN_VIEN.HealthInsuranceFromDate;
                    }
                    catch (Exception eHealthInsuranceFromDate)
                    {
                        String HealthInsuranceFromDateMessage = eHealthInsuranceFromDate.Message;
                        HealthInsuranceFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@HealthInsuranceFromDate"].Value = HealthInsuranceFromDateSQL;
                SqlDateTime HealthInsuranceToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.HealthInsuranceToDate > DateTime.MinValue)
                {
                    try
                    {
                        HealthInsuranceToDateSQL = NHAN_VIEN.HealthInsuranceToDate;
                    }
                    catch (Exception eHealthInsuranceToDate)
                    {
                        String HealthInsuranceToDateMessage = eHealthInsuranceToDate.Message;
                        HealthInsuranceToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@HealthInsuranceToDate"].Value = HealthInsuranceToDateSQL;
                SqlString ContractCodeSQL = NHAN_VIEN.ContractCode;
                _dbadapter.UpdateCommand.Parameters["@ContractCode"].Value = ContractCodeSQL;
                SqlString ContractTypeSQL = NHAN_VIEN.ContractType;
                _dbadapter.UpdateCommand.Parameters["@ContractType"].Value = ContractTypeSQL;
                SqlDateTime ContractSignDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractSignDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractSignDateSQL = NHAN_VIEN.ContractSignDate;
                    }
                    catch (Exception eContractSignDate)
                    {
                        String ContractSignDateMessage = eContractSignDate.Message;
                        ContractSignDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@ContractSignDate"].Value = ContractSignDateSQL;
                SqlDateTime ContractFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractFromDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractFromDateSQL = NHAN_VIEN.ContractFromDate;
                    }
                    catch (Exception eContractFromDate)
                    {
                        String ContractFromDateMessage = eContractFromDate.Message;
                        ContractFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@ContractFromDate"].Value = ContractFromDateSQL;
                SqlDateTime ContractToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.ContractToDate > DateTime.MinValue)
                {
                    try
                    {
                        ContractToDateSQL = NHAN_VIEN.ContractToDate;
                    }
                    catch (Exception eContractToDate)
                    {
                        String ContractToDateMessage = eContractToDate.Message;
                        ContractToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@ContractToDate"].Value = ContractToDateSQL;
                SqlString ProvinceSQL = NHAN_VIEN.Province;
                _dbadapter.UpdateCommand.Parameters["@Province"].Value = ProvinceSQL;
                SqlString HospitalSQL = NHAN_VIEN.Hospital;
                _dbadapter.UpdateCommand.Parameters["@Hospital"].Value = HospitalSQL;
                SqlString MilitaryCodeSQL = NHAN_VIEN.MilitaryCode;
                _dbadapter.UpdateCommand.Parameters["@MilitaryCode"].Value = MilitaryCodeSQL;
                SqlDateTime MilitaryFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.MilitaryFromDate > DateTime.MinValue)
                {
                    try
                    {
                        MilitaryFromDateSQL = NHAN_VIEN.MilitaryFromDate;
                    }
                    catch (Exception eMilitaryFromDate)
                    {
                        String MilitaryFromDateMessage = eMilitaryFromDate.Message;
                        MilitaryFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@MilitaryFromDate"].Value = MilitaryFromDateSQL;
                SqlDateTime MilitaryToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.MilitaryToDate > DateTime.MinValue)
                {
                    try
                    {
                        MilitaryToDateSQL = NHAN_VIEN.MilitaryToDate;
                    }
                    catch (Exception eMilitaryToDate)
                    {
                        String MilitaryToDateMessage = eMilitaryToDate.Message;
                        MilitaryToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@MilitaryToDate"].Value = MilitaryToDateSQL;
                SqlString MilitaryPositionSQL = NHAN_VIEN.MilitaryPosition;
                _dbadapter.UpdateCommand.Parameters["@MilitaryPosition"].Value = MilitaryPositionSQL;
                SqlString PassportCodeSQL = NHAN_VIEN.PassportCode;
                _dbadapter.UpdateCommand.Parameters["@PassportCode"].Value = PassportCodeSQL;
                SqlDateTime PassportFromDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PassportFromDate > DateTime.MinValue)
                {
                    try
                    {
                        PassportFromDateSQL = NHAN_VIEN.PassportFromDate;
                    }
                    catch (Exception ePassportFromDate)
                    {
                        String PassportFromDateMessage = ePassportFromDate.Message;
                        PassportFromDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@PassportFromDate"].Value = PassportFromDateSQL;
                SqlDateTime PassportToDateSQL = SqlDateTime.Null;
                if (NHAN_VIEN.PassportToDate > DateTime.MinValue)
                {
                    try
                    {
                        PassportToDateSQL = NHAN_VIEN.PassportToDate;
                    }
                    catch (Exception ePassportToDate)
                    {
                        String PassportToDateMessage = ePassportToDate.Message;
                        PassportToDateSQL = SqlDateTime.Null;
                    }
                }
                _dbadapter.UpdateCommand.Parameters["@PassportToDate"].Value = PassportToDateSQL;
                SqlInt32 StatusSQL = NHAN_VIEN.Status;
                _dbadapter.UpdateCommand.Parameters["@Status"].Value = StatusSQL;
                SqlString AccountSQL = NHAN_VIEN.Account;
                _dbadapter.UpdateCommand.Parameters["@Account"].Value = AccountSQL;
                SqlString PasswordSQL = NHAN_VIEN.Password;
                _dbadapter.UpdateCommand.Parameters["@Password"].Value = PasswordSQL;
                SqlString DescriptionSQL = NHAN_VIEN.Description;
                _dbadapter.UpdateCommand.Parameters["@Description"].Value = DescriptionSQL;


				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_EMPLOYEE_Update: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_EMPLOYEE_Update: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_EMPLOYEE_Disable(String EmployeeCode, ref Boolean Enabled)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_EMPLOYEE_Disable");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@enabled", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Prepare();
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				_dbadapter.UpdateCommand.Parameters["@enabled"].Direction = ParameterDirection.Output;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_EMPLOYEE_Disable: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_EMPLOYEE_Disable: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_EMPLOYEE_Delete(String EmployeeCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.DeleteCommand = new SqlCommand("HRM_EMPLOYEE_Delete");
				_dbadapter.DeleteCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.DeleteCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.DeleteCommand.Transaction = _trans;

				_dbadapter.DeleteCommand.Parameters.Clear();
				_dbadapter.DeleteCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.DeleteCommand.Prepare();
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.DeleteCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.DeleteCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_EMPLOYEE_Delete: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_EMPLOYEE_Delete: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.DeleteCommand != null)
					_dbadapter.DeleteCommand.Dispose();
				CloseConnection();
			}
		}
		public Int32 HRM_EMPLOYEE_Save(String EmployeeCode, String BranchCode, String DepartmentCode, String GroupCode, String CandidateCode, String EnrollNumber, String FirstName, String LastName, String Alias, Boolean Sex, String Marriage, DateTime Birthday, String BirthPlace, String MainAddress, String ContactAddress, String CellPhone, String HomePhone, String Email, String Photo, String Nationality, String Ethnic, String Religion, String Education, String Language, String Informatic, String Professional, String Position, String School, String IDCard, DateTime IDCardDate, String IDCardPlace, Boolean IsTest, String TestTime, DateTime TestFromDate, DateTime TestToDate, Decimal TestSalary, DateTime BeginDate, Boolean IsOffWork, DateTime EndDate, String Health, Double Height, Double Weight, Int32 PayForm, Decimal PayMoney, Decimal MinimumSalary, String RankSalary, Int32 StepSalary, Double CoefficientSalary, DateTime DateSalary, Decimal BasicSalary, Decimal InsuranceSalary, Decimal Allowance1, Decimal Allowance2, Decimal Allowance3, Decimal Allowance4, Boolean IsSocialInsurance, Boolean IsHealthInsurance, Boolean IsUnemploymentInsurance, Boolean IsUnionMoney, String BankCode, DateTime BankDate, String BankName, String BankAddress, String LaborCode, DateTime LaborDate, String LaborPlace, Boolean IsUnion, String UnionCode, DateTime UnionDate, String UnionPlace, Boolean IsParty, String PartyCode, DateTime PartyDate, String PartyPlace, String InsuranceCode, DateTime InsuranceDate, String InsurancePlace, String HealthInsuranceCode, DateTime HealthInsuranceFromDate, DateTime HealthInsuranceToDate, String ContractCode, String ContractType, DateTime ContractSignDate, DateTime ContractFromDate, DateTime ContractToDate, String Province, String Hospital, String MilitaryCode, DateTime MilitaryFromDate, DateTime MilitaryToDate, String MilitaryPosition, String PassportCode, DateTime PassportFromDate, DateTime PassportToDate, Int32 Status, String Account, String Password, String Description)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.UpdateCommand = new SqlCommand("HRM_EMPLOYEE_Save");
				_dbadapter.UpdateCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.UpdateCommand.Connection = _dbconn;

				_trans = _dbconn.BeginTransaction();
				_dbadapter.UpdateCommand.Transaction = _trans;

				_dbadapter.UpdateCommand.Parameters.Clear();
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BranchCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DepartmentCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@GroupCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CandidateCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EnrollNumber", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LastName", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Alias", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Sex", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Marriage", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Birthday", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BirthPlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MainAddress", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContactAddress", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CellPhone", SqlDbType.NVarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HomePhone", SqlDbType.NVarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Email", SqlDbType.VarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Photo", SqlDbType.Image));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Nationality", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Ethnic", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Religion", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Education", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Language", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Informatic", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Professional", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Position", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@School", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCard", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCardDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IDCardPlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsTest", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestTime", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestFromDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestToDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@TestSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BeginDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsOffWork", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Health", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Height", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Weight", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PayForm", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PayMoney", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MinimumSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@RankSalary", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@StepSalary", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@CoefficientSalary", SqlDbType.Float));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@DateSalary", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BasicSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceSalary", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance1", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance2", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance3", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Allowance4", SqlDbType.Money));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsSocialInsurance", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsHealthInsurance", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnemploymentInsurance", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnionMoney", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankCode", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankName", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@BankAddress", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@LaborPlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsUnion", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@UnionPlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@IsParty", SqlDbType.Bit));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PartyPlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsuranceDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@InsurancePlace", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceFromDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@HealthInsuranceToDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractType", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractSignDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractFromDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@ContractToDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Province", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Hospital", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryFromDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryToDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@MilitaryPosition", SqlDbType.NVarChar, 100));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportCode", SqlDbType.VarChar, 20));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportFromDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@PassportToDate", SqlDbType.DateTime));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Account", SqlDbType.NVarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Password", SqlDbType.VarChar, 50));
				_dbadapter.UpdateCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 255));
				_dbadapter.UpdateCommand.Prepare();
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.UpdateCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				SqlString BranchCodeSQL = BranchCode;
				_dbadapter.UpdateCommand.Parameters["@BranchCode"].Value = BranchCodeSQL;
				SqlString DepartmentCodeSQL = DepartmentCode;
				_dbadapter.UpdateCommand.Parameters["@DepartmentCode"].Value = DepartmentCodeSQL;
				SqlString GroupCodeSQL = GroupCode;
				_dbadapter.UpdateCommand.Parameters["@GroupCode"].Value = GroupCodeSQL;
				SqlString CandidateCodeSQL = CandidateCode;
				_dbadapter.UpdateCommand.Parameters["@CandidateCode"].Value = CandidateCodeSQL;
				SqlString EnrollNumberSQL = EnrollNumber;
				_dbadapter.UpdateCommand.Parameters["@EnrollNumber"].Value = EnrollNumberSQL;
				SqlString FirstNameSQL = FirstName;
				_dbadapter.UpdateCommand.Parameters["@FirstName"].Value = FirstNameSQL;
				SqlString LastNameSQL = LastName;
				_dbadapter.UpdateCommand.Parameters["@LastName"].Value = LastNameSQL;
				SqlString AliasSQL = Alias;
				_dbadapter.UpdateCommand.Parameters["@Alias"].Value = AliasSQL;
				SqlBoolean SexSQL = Sex;
				_dbadapter.UpdateCommand.Parameters["@Sex"].Value = SexSQL;
				SqlString MarriageSQL = Marriage;
				_dbadapter.UpdateCommand.Parameters["@Marriage"].Value = MarriageSQL;
				SqlDateTime BirthdaySQL = SqlDateTime.Null;
				if (Birthday > DateTime.MinValue)
				{
					try
					{
						BirthdaySQL = Birthday;
					}
					catch (Exception eBirthday)
					{
						String BirthdayMessage = eBirthday.Message;
						BirthdaySQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@Birthday"].Value = BirthdaySQL;
				SqlString BirthPlaceSQL = BirthPlace;
				_dbadapter.UpdateCommand.Parameters["@BirthPlace"].Value = BirthPlaceSQL;
				SqlString MainAddressSQL = MainAddress;
				_dbadapter.UpdateCommand.Parameters["@MainAddress"].Value = MainAddressSQL;
				SqlString ContactAddressSQL = ContactAddress;
				_dbadapter.UpdateCommand.Parameters["@ContactAddress"].Value = ContactAddressSQL;
				SqlString CellPhoneSQL = CellPhone;
				_dbadapter.UpdateCommand.Parameters["@CellPhone"].Value = CellPhoneSQL;
				SqlString HomePhoneSQL = HomePhone;
				_dbadapter.UpdateCommand.Parameters["@HomePhone"].Value = HomePhoneSQL;
				SqlString EmailSQL = Email;
				_dbadapter.UpdateCommand.Parameters["@Email"].Value = EmailSQL;
				SqlBinary PhotoSQL = Convert.FromBase64String(Photo);
				_dbadapter.UpdateCommand.Parameters["@Photo"].Value = PhotoSQL;
				SqlString NationalitySQL = Nationality;
				_dbadapter.UpdateCommand.Parameters["@Nationality"].Value = NationalitySQL;
				SqlString EthnicSQL = Ethnic;
				_dbadapter.UpdateCommand.Parameters["@Ethnic"].Value = EthnicSQL;
				SqlString ReligionSQL = Religion;
				_dbadapter.UpdateCommand.Parameters["@Religion"].Value = ReligionSQL;
				SqlString EducationSQL = Education;
				_dbadapter.UpdateCommand.Parameters["@Education"].Value = EducationSQL;
				SqlString LanguageSQL = Language;
				_dbadapter.UpdateCommand.Parameters["@Language"].Value = LanguageSQL;
				SqlString InformaticSQL = Informatic;
				_dbadapter.UpdateCommand.Parameters["@Informatic"].Value = InformaticSQL;
				SqlString ProfessionalSQL = Professional;
				_dbadapter.UpdateCommand.Parameters["@Professional"].Value = ProfessionalSQL;
				SqlString PositionSQL = Position;
				_dbadapter.UpdateCommand.Parameters["@Position"].Value = PositionSQL;
				SqlString SchoolSQL = School;
				_dbadapter.UpdateCommand.Parameters["@School"].Value = SchoolSQL;
				SqlString IDCardSQL = IDCard;
				_dbadapter.UpdateCommand.Parameters["@IDCard"].Value = IDCardSQL;
				SqlDateTime IDCardDateSQL = SqlDateTime.Null;
				if (IDCardDate > DateTime.MinValue)
				{
					try
					{
						IDCardDateSQL = IDCardDate;
					}
					catch (Exception eIDCardDate)
					{
						String IDCardDateMessage = eIDCardDate.Message;
						IDCardDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@IDCardDate"].Value = IDCardDateSQL;
				SqlString IDCardPlaceSQL = IDCardPlace;
				_dbadapter.UpdateCommand.Parameters["@IDCardPlace"].Value = IDCardPlaceSQL;
				SqlBoolean IsTestSQL = IsTest;
				_dbadapter.UpdateCommand.Parameters["@IsTest"].Value = IsTestSQL;
				SqlString TestTimeSQL = TestTime;
				_dbadapter.UpdateCommand.Parameters["@TestTime"].Value = TestTimeSQL;
				SqlDateTime TestFromDateSQL = SqlDateTime.Null;
				if (TestFromDate > DateTime.MinValue)
				{
					try
					{
						TestFromDateSQL = TestFromDate;
					}
					catch (Exception eTestFromDate)
					{
						String TestFromDateMessage = eTestFromDate.Message;
						TestFromDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TestFromDate"].Value = TestFromDateSQL;
				SqlDateTime TestToDateSQL = SqlDateTime.Null;
				if (TestToDate > DateTime.MinValue)
				{
					try
					{
						TestToDateSQL = TestToDate;
					}
					catch (Exception eTestToDate)
					{
						String TestToDateMessage = eTestToDate.Message;
						TestToDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@TestToDate"].Value = TestToDateSQL;
				SqlMoney TestSalarySQL = TestSalary;
				_dbadapter.UpdateCommand.Parameters["@TestSalary"].Value = TestSalarySQL;
				SqlDateTime BeginDateSQL = SqlDateTime.Null;
				if (BeginDate > DateTime.MinValue)
				{
					try
					{
						BeginDateSQL = BeginDate;
					}
					catch (Exception eBeginDate)
					{
						String BeginDateMessage = eBeginDate.Message;
						BeginDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@BeginDate"].Value = BeginDateSQL;
				SqlBoolean IsOffWorkSQL = IsOffWork;
				_dbadapter.UpdateCommand.Parameters["@IsOffWork"].Value = IsOffWorkSQL;
				SqlDateTime EndDateSQL = SqlDateTime.Null;
				if (EndDate > DateTime.MinValue)
				{
					try
					{
						EndDateSQL = EndDate;
					}
					catch (Exception eEndDate)
					{
						String EndDateMessage = eEndDate.Message;
						EndDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@EndDate"].Value = EndDateSQL;
				SqlString HealthSQL = Health;
				_dbadapter.UpdateCommand.Parameters["@Health"].Value = HealthSQL;
				SqlDouble HeightSQL = Height;
				_dbadapter.UpdateCommand.Parameters["@Height"].Value = HeightSQL;
				SqlDouble WeightSQL = Weight;
				_dbadapter.UpdateCommand.Parameters["@Weight"].Value = WeightSQL;
				SqlInt32 PayFormSQL = PayForm;
				_dbadapter.UpdateCommand.Parameters["@PayForm"].Value = PayFormSQL;
				SqlMoney PayMoneySQL = PayMoney;
				_dbadapter.UpdateCommand.Parameters["@PayMoney"].Value = PayMoneySQL;
				SqlMoney MinimumSalarySQL = MinimumSalary;
				_dbadapter.UpdateCommand.Parameters["@MinimumSalary"].Value = MinimumSalarySQL;
				SqlString RankSalarySQL = RankSalary;
				_dbadapter.UpdateCommand.Parameters["@RankSalary"].Value = RankSalarySQL;
				SqlInt32 StepSalarySQL = StepSalary;
				_dbadapter.UpdateCommand.Parameters["@StepSalary"].Value = StepSalarySQL;
				SqlDouble CoefficientSalarySQL = CoefficientSalary;
				_dbadapter.UpdateCommand.Parameters["@CoefficientSalary"].Value = CoefficientSalarySQL;
				SqlDateTime DateSalarySQL = SqlDateTime.Null;
				if (DateSalary > DateTime.MinValue)
				{
					try
					{
						DateSalarySQL = DateSalary;
					}
					catch (Exception eDateSalary)
					{
						String DateSalaryMessage = eDateSalary.Message;
						DateSalarySQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@DateSalary"].Value = DateSalarySQL;
				SqlMoney BasicSalarySQL = BasicSalary;
				_dbadapter.UpdateCommand.Parameters["@BasicSalary"].Value = BasicSalarySQL;
				SqlMoney InsuranceSalarySQL = InsuranceSalary;
				_dbadapter.UpdateCommand.Parameters["@InsuranceSalary"].Value = InsuranceSalarySQL;
				SqlMoney Allowance1SQL = Allowance1;
				_dbadapter.UpdateCommand.Parameters["@Allowance1"].Value = Allowance1SQL;
				SqlMoney Allowance2SQL = Allowance2;
				_dbadapter.UpdateCommand.Parameters["@Allowance2"].Value = Allowance2SQL;
				SqlMoney Allowance3SQL = Allowance3;
				_dbadapter.UpdateCommand.Parameters["@Allowance3"].Value = Allowance3SQL;
				SqlMoney Allowance4SQL = Allowance4;
				_dbadapter.UpdateCommand.Parameters["@Allowance4"].Value = Allowance4SQL;
				SqlBoolean IsSocialInsuranceSQL = IsSocialInsurance;
				_dbadapter.UpdateCommand.Parameters["@IsSocialInsurance"].Value = IsSocialInsuranceSQL;
				SqlBoolean IsHealthInsuranceSQL = IsHealthInsurance;
				_dbadapter.UpdateCommand.Parameters["@IsHealthInsurance"].Value = IsHealthInsuranceSQL;
				SqlBoolean IsUnemploymentInsuranceSQL = IsUnemploymentInsurance;
				_dbadapter.UpdateCommand.Parameters["@IsUnemploymentInsurance"].Value = IsUnemploymentInsuranceSQL;
				SqlBoolean IsUnionMoneySQL = IsUnionMoney;
				_dbadapter.UpdateCommand.Parameters["@IsUnionMoney"].Value = IsUnionMoneySQL;
				SqlString BankCodeSQL = BankCode;
				_dbadapter.UpdateCommand.Parameters["@BankCode"].Value = BankCodeSQL;
				SqlDateTime BankDateSQL = SqlDateTime.Null;
				if (BankDate > DateTime.MinValue)
				{
					try
					{
						BankDateSQL = BankDate;
					}
					catch (Exception eBankDate)
					{
						String BankDateMessage = eBankDate.Message;
						BankDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@BankDate"].Value = BankDateSQL;
				SqlString BankNameSQL = BankName;
				_dbadapter.UpdateCommand.Parameters["@BankName"].Value = BankNameSQL;
				SqlString BankAddressSQL = BankAddress;
				_dbadapter.UpdateCommand.Parameters["@BankAddress"].Value = BankAddressSQL;
				SqlString LaborCodeSQL = LaborCode;
				_dbadapter.UpdateCommand.Parameters["@LaborCode"].Value = LaborCodeSQL;
				SqlDateTime LaborDateSQL = SqlDateTime.Null;
				if (LaborDate > DateTime.MinValue)
				{
					try
					{
						LaborDateSQL = LaborDate;
					}
					catch (Exception eLaborDate)
					{
						String LaborDateMessage = eLaborDate.Message;
						LaborDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@LaborDate"].Value = LaborDateSQL;
				SqlString LaborPlaceSQL = LaborPlace;
				_dbadapter.UpdateCommand.Parameters["@LaborPlace"].Value = LaborPlaceSQL;
				SqlBoolean IsUnionSQL = IsUnion;
				_dbadapter.UpdateCommand.Parameters["@IsUnion"].Value = IsUnionSQL;
				SqlString UnionCodeSQL = UnionCode;
				_dbadapter.UpdateCommand.Parameters["@UnionCode"].Value = UnionCodeSQL;
				SqlDateTime UnionDateSQL = SqlDateTime.Null;
				if (UnionDate > DateTime.MinValue)
				{
					try
					{
						UnionDateSQL = UnionDate;
					}
					catch (Exception eUnionDate)
					{
						String UnionDateMessage = eUnionDate.Message;
						UnionDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@UnionDate"].Value = UnionDateSQL;
				SqlString UnionPlaceSQL = UnionPlace;
				_dbadapter.UpdateCommand.Parameters["@UnionPlace"].Value = UnionPlaceSQL;
				SqlBoolean IsPartySQL = IsParty;
				_dbadapter.UpdateCommand.Parameters["@IsParty"].Value = IsPartySQL;
				SqlString PartyCodeSQL = PartyCode;
				_dbadapter.UpdateCommand.Parameters["@PartyCode"].Value = PartyCodeSQL;
				SqlDateTime PartyDateSQL = SqlDateTime.Null;
				if (PartyDate > DateTime.MinValue)
				{
					try
					{
						PartyDateSQL = PartyDate;
					}
					catch (Exception ePartyDate)
					{
						String PartyDateMessage = ePartyDate.Message;
						PartyDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@PartyDate"].Value = PartyDateSQL;
				SqlString PartyPlaceSQL = PartyPlace;
				_dbadapter.UpdateCommand.Parameters["@PartyPlace"].Value = PartyPlaceSQL;
				SqlString InsuranceCodeSQL = InsuranceCode;
				_dbadapter.UpdateCommand.Parameters["@InsuranceCode"].Value = InsuranceCodeSQL;
				SqlDateTime InsuranceDateSQL = SqlDateTime.Null;
				if (InsuranceDate > DateTime.MinValue)
				{
					try
					{
						InsuranceDateSQL = InsuranceDate;
					}
					catch (Exception eInsuranceDate)
					{
						String InsuranceDateMessage = eInsuranceDate.Message;
						InsuranceDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@InsuranceDate"].Value = InsuranceDateSQL;
				SqlString InsurancePlaceSQL = InsurancePlace;
				_dbadapter.UpdateCommand.Parameters["@InsurancePlace"].Value = InsurancePlaceSQL;
				SqlString HealthInsuranceCodeSQL = HealthInsuranceCode;
				_dbadapter.UpdateCommand.Parameters["@HealthInsuranceCode"].Value = HealthInsuranceCodeSQL;
				SqlDateTime HealthInsuranceFromDateSQL = SqlDateTime.Null;
				if (HealthInsuranceFromDate > DateTime.MinValue)
				{
					try
					{
						HealthInsuranceFromDateSQL = HealthInsuranceFromDate;
					}
					catch (Exception eHealthInsuranceFromDate)
					{
						String HealthInsuranceFromDateMessage = eHealthInsuranceFromDate.Message;
						HealthInsuranceFromDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@HealthInsuranceFromDate"].Value = HealthInsuranceFromDateSQL;
				SqlDateTime HealthInsuranceToDateSQL = SqlDateTime.Null;
				if (HealthInsuranceToDate > DateTime.MinValue)
				{
					try
					{
						HealthInsuranceToDateSQL = HealthInsuranceToDate;
					}
					catch (Exception eHealthInsuranceToDate)
					{
						String HealthInsuranceToDateMessage = eHealthInsuranceToDate.Message;
						HealthInsuranceToDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@HealthInsuranceToDate"].Value = HealthInsuranceToDateSQL;
				SqlString ContractCodeSQL = ContractCode;
				_dbadapter.UpdateCommand.Parameters["@ContractCode"].Value = ContractCodeSQL;
				SqlString ContractTypeSQL = ContractType;
				_dbadapter.UpdateCommand.Parameters["@ContractType"].Value = ContractTypeSQL;
				SqlDateTime ContractSignDateSQL = SqlDateTime.Null;
				if (ContractSignDate > DateTime.MinValue)
				{
					try
					{
						ContractSignDateSQL = ContractSignDate;
					}
					catch (Exception eContractSignDate)
					{
						String ContractSignDateMessage = eContractSignDate.Message;
						ContractSignDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@ContractSignDate"].Value = ContractSignDateSQL;
				SqlDateTime ContractFromDateSQL = SqlDateTime.Null;
				if (ContractFromDate > DateTime.MinValue)
				{
					try
					{
						ContractFromDateSQL = ContractFromDate;
					}
					catch (Exception eContractFromDate)
					{
						String ContractFromDateMessage = eContractFromDate.Message;
						ContractFromDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@ContractFromDate"].Value = ContractFromDateSQL;
				SqlDateTime ContractToDateSQL = SqlDateTime.Null;
				if (ContractToDate > DateTime.MinValue)
				{
					try
					{
						ContractToDateSQL = ContractToDate;
					}
					catch (Exception eContractToDate)
					{
						String ContractToDateMessage = eContractToDate.Message;
						ContractToDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@ContractToDate"].Value = ContractToDateSQL;
				SqlString ProvinceSQL = Province;
				_dbadapter.UpdateCommand.Parameters["@Province"].Value = ProvinceSQL;
				SqlString HospitalSQL = Hospital;
				_dbadapter.UpdateCommand.Parameters["@Hospital"].Value = HospitalSQL;
				SqlString MilitaryCodeSQL = MilitaryCode;
				_dbadapter.UpdateCommand.Parameters["@MilitaryCode"].Value = MilitaryCodeSQL;
				SqlDateTime MilitaryFromDateSQL = SqlDateTime.Null;
				if (MilitaryFromDate > DateTime.MinValue)
				{
					try
					{
						MilitaryFromDateSQL = MilitaryFromDate;
					}
					catch (Exception eMilitaryFromDate)
					{
						String MilitaryFromDateMessage = eMilitaryFromDate.Message;
						MilitaryFromDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@MilitaryFromDate"].Value = MilitaryFromDateSQL;
				SqlDateTime MilitaryToDateSQL = SqlDateTime.Null;
				if (MilitaryToDate > DateTime.MinValue)
				{
					try
					{
						MilitaryToDateSQL = MilitaryToDate;
					}
					catch (Exception eMilitaryToDate)
					{
						String MilitaryToDateMessage = eMilitaryToDate.Message;
						MilitaryToDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@MilitaryToDate"].Value = MilitaryToDateSQL;
				SqlString MilitaryPositionSQL = MilitaryPosition;
				_dbadapter.UpdateCommand.Parameters["@MilitaryPosition"].Value = MilitaryPositionSQL;
				SqlString PassportCodeSQL = PassportCode;
				_dbadapter.UpdateCommand.Parameters["@PassportCode"].Value = PassportCodeSQL;
				SqlDateTime PassportFromDateSQL = SqlDateTime.Null;
				if (PassportFromDate > DateTime.MinValue)
				{
					try
					{
						PassportFromDateSQL = PassportFromDate;
					}
					catch (Exception ePassportFromDate)
					{
						String PassportFromDateMessage = ePassportFromDate.Message;
						PassportFromDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@PassportFromDate"].Value = PassportFromDateSQL;
				SqlDateTime PassportToDateSQL = SqlDateTime.Null;
				if (PassportToDate > DateTime.MinValue)
				{
					try
					{
						PassportToDateSQL = PassportToDate;
					}
					catch (Exception ePassportToDate)
					{
						String PassportToDateMessage = ePassportToDate.Message;
						PassportToDateSQL = SqlDateTime.Null;
					}
				}
				_dbadapter.UpdateCommand.Parameters["@PassportToDate"].Value = PassportToDateSQL;
				SqlInt32 StatusSQL = Status;
				_dbadapter.UpdateCommand.Parameters["@Status"].Value = StatusSQL;
				SqlString AccountSQL = Account;
				_dbadapter.UpdateCommand.Parameters["@Account"].Value = AccountSQL;
				SqlString PasswordSQL = Password;
				_dbadapter.UpdateCommand.Parameters["@Password"].Value = PasswordSQL;
				SqlString DescriptionSQL = Description;
				_dbadapter.UpdateCommand.Parameters["@Description"].Value = DescriptionSQL;
				Int32 returnvalue = Convert.ToInt32(_dbadapter.UpdateCommand.ExecuteScalar());

				_trans.Commit();
				return returnvalue;
			}
			catch (SqlException e)
			{
				try
				{
					_trans.Rollback();
				}
				catch (SqlException ex)
				{
					throw new Exception("SQL Rollback Error: HRM_EMPLOYEE_Save: " + ex.Message, ex);
				}
				throw new Exception("SQL Error: HRM_EMPLOYEE_Save: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.UpdateCommand != null)
					_dbadapter.UpdateCommand.Dispose();
				CloseConnection();
			}
		}
        public DataSet HRM_EMPLOYEE_GetList(int Status, DateTime DayFirstMonth, DateTime DayEndMonth)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetList");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayFirstMonth", SqlDbType.DateTime));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayEndMonth", SqlDbType.DateTime));
                _dbadapter.SelectCommand.Prepare();
                SqlInt32 StatusSQL = Status;
                _dbadapter.SelectCommand.Parameters["@Status"].Value = StatusSQL;
                SqlDateTime DayFirstMonthSQL = DayFirstMonth;
                _dbadapter.SelectCommand.Parameters["@DayFirstMonth"].Value = DayFirstMonthSQL;
                SqlDateTime DayEndMonthSQL = DayEndMonth;
                _dbadapter.SelectCommand.Parameters["@DayEndMonth"].Value = DayEndMonthSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_EMPLOYEE_GetList: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
        public DataSet HRM_EMPLOYEE_GetListAll()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetList");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetList: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
		public DataSet HRM_EMPLOYEE_Get(String EmployeeCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_Get");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@EmployeeCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Prepare();
				SqlString EmployeeCodeSQL = EmployeeCode;
				_dbadapter.SelectCommand.Parameters["@EmployeeCode"].Value = EmployeeCodeSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_EMPLOYEE_Get: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}

		public DataSet HRM_EMPLOYEE_GetListByDepartmentCode(String DepartmentCode)
		{
			try
			{
				if (_dbconn.State != ConnectionState.Open)
					_dbconn.Open();
				_dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListByDepartmentCode");
				_dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
				_dbadapter.SelectCommand.Connection = _dbconn;
				_dbadapter.SelectCommand.Parameters.Clear();
				_dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DepartmentCode", SqlDbType.VarChar, 20));
				_dbadapter.SelectCommand.Prepare();
				SqlString DepartmentCodeSQL = DepartmentCode;
				_dbadapter.SelectCommand.Parameters["@DepartmentCode"].Value = DepartmentCodeSQL;
				_dbadapter.Fill(_data);

				return _data;
			}
			catch (SqlException e)
			{
				throw new Exception("SQL Error: HRM_EMPLOYEE_GetListByDepartmentCode: " + e.Message, e);
			}
			finally
			{
				if (_dbadapter.SelectCommand != null)
					_dbadapter.SelectCommand.Dispose();
				CloseConnection();
			}
		}
        public DataSet HRM_EMPLOYEE_Count()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_Count");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_Count: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetAge()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetAge");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetAge: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetAllSex()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetAllSex");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetAllSex: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetByEnroll(String EnrollNumber)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetByEnroll");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();

                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@EnrollNumber", SqlDbType.VarChar, 20));

                _dbadapter.SelectCommand.Prepare();

                SqlString EnrollNumberSQL = EnrollNumber;
                _dbadapter.SelectCommand.Parameters["@EnrollNumber"].Value = EnrollNumberSQL;


                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_Get: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetEducation()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetEducation");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetEducation: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetEthnic()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetEthnic");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetEthnic: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetIncreaseDecreaseList(int Level, String Code,int Status, int Month, int Year)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetIncreaseDecreaseList");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Level", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Code", SqlDbType.VarChar));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Month", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Year", SqlDbType.Int));
             
                _dbadapter.SelectCommand.Prepare();
                SqlInt32 LevelSQL = Level;
                _dbadapter.SelectCommand.Parameters["@Level"].Value = LevelSQL;
                SqlString CodeSQL = Code;
                _dbadapter.SelectCommand.Parameters["@Code"].Value = CodeSQL;
                SqlInt32 StatusSQL = Status;
                _dbadapter.SelectCommand.Parameters["@Status"].Value = StatusSQL;
                SqlInt32 MonthSQL = Month;
                _dbadapter.SelectCommand.Parameters["@Month"].Value = MonthSQL;
                SqlInt32 YearSQL = Year;
                _dbadapter.SelectCommand.Parameters["@Year"].Value = YearSQL;
               
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetIncreaseDecreaseList: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListBirthday()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListBirthday");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListBirthday: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListBirthdayByMonth(int Month)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListBirthdayByMonth");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();

                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Month", SqlDbType.Int));

                _dbadapter.SelectCommand.Prepare();

                SqlInt32 MonthSQL = Month;
                _dbadapter.SelectCommand.Parameters["@Month"].Value = MonthSQL;


                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListBirthdayByMonth: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListByBranch(String BranchCode, int Status, DateTime DayFirstMonth, DateTime DayEndMonth)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListByBranch");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@BranchCode", SqlDbType.VarChar));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayFirstMonth", SqlDbType.DateTime));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayEndMonth", SqlDbType.DateTime));

                _dbadapter.SelectCommand.Prepare();
                SqlString BranchCodeSQL = BranchCode;
                _dbadapter.SelectCommand.Parameters["@BranchCode"].Value = BranchCodeSQL;
                SqlInt32 StatusSQL = Status;
                _dbadapter.SelectCommand.Parameters["@Status"].Value = StatusSQL;
                SqlDateTime DayFirstMonthSQL = DayFirstMonth;
                _dbadapter.SelectCommand.Parameters["@DayFirstMonth"].Value = DayFirstMonthSQL;
                SqlDateTime DayEndMonthSQL = DayEndMonth;
                _dbadapter.SelectCommand.Parameters["@DayEndMonth"].Value = DayEndMonthSQL;

                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListByBranch: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListByDepartment(String DepartmentCode, int Status, DateTime DayFirstMonth, DateTime DayEndMonth)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListByDepartment");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DepartmentCode", SqlDbType.VarChar));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayFirstMonth", SqlDbType.DateTime));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayEndMonth", SqlDbType.DateTime));

                _dbadapter.SelectCommand.Prepare();
                SqlString DepartmentCodeSQL = DepartmentCode;
                _dbadapter.SelectCommand.Parameters["@DepartmentCode"].Value = DepartmentCodeSQL;
                SqlInt32 StatusSQL = Status;
                _dbadapter.SelectCommand.Parameters["@Status"].Value = StatusSQL;
                SqlDateTime DayFirstMonthSQL = DayFirstMonth;
                _dbadapter.SelectCommand.Parameters["@DayFirstMonth"].Value = DayFirstMonthSQL;
                SqlDateTime DayEndMonthSQL = DayEndMonth;
                _dbadapter.SelectCommand.Parameters["@DayEndMonth"].Value = DayEndMonthSQL;

                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListByDepartment: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListByGroup(String GroupCode, int Status, DateTime DayFirstMonth, DateTime DayEndMonth)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListByGroup");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@GroupCode", SqlDbType.VarChar));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Status", SqlDbType.Int));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayFirstMonth", SqlDbType.DateTime));
                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@DayEndMonth", SqlDbType.DateTime));

                _dbadapter.SelectCommand.Prepare();
                SqlString GroupCodeSQL = GroupCode;
                _dbadapter.SelectCommand.Parameters["@GroupCode"].Value = GroupCodeSQL;
                SqlInt32 StatusSQL = Status;
                _dbadapter.SelectCommand.Parameters["@Status"].Value = StatusSQL;
                SqlDateTime DayFirstMonthSQL = DayFirstMonth;
                _dbadapter.SelectCommand.Parameters["@DayFirstMonth"].Value = DayFirstMonthSQL;
                SqlDateTime DayEndMonthSQL = DayEndMonth;
                _dbadapter.SelectCommand.Parameters["@DayEndMonth"].Value = DayEndMonthSQL;

                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListByGroup: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetListByYear(int Year)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetListByYear");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();

                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@Year", SqlDbType.Int));

                _dbadapter.SelectCommand.Prepare();

                SqlInt32 YearSQL = Year;
                _dbadapter.SelectCommand.Parameters["@Year"].Value = YearSQL;


                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetListByYear: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetMarriage()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetMarriage");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetMarriage: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetNationality()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetNationality");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetNationality: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetPosition()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetPosition");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetPosition: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetRate(int FromYear, int ToYear)
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetRate");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();

                _dbadapter.SelectCommand.Parameters.Add(new SqlParameter("@FromYear", SqlDbType.Int));

                _dbadapter.SelectCommand.Prepare();

                SqlInt32 FromYearSQL = FromYear;
                _dbadapter.SelectCommand.Parameters["@FromYear"].Value = FromYearSQL;
                SqlInt32 ToYearSQL = ToYear;
                _dbadapter.SelectCommand.Parameters["@ToYear"].Value = ToYearSQL;

                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetRate: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetReligion()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetReligion");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetReligion: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetSex()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetSex");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetSex: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetStatistical()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetStatistical");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetStatistical: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }
        public DataSet HRM_EMPLOYEE_GetStatus()
        {
            try
            {
                if (_dbconn.State != ConnectionState.Open)
                    _dbconn.Open();
                _dbadapter.SelectCommand = new SqlCommand("HRM_EMPLOYEE_GetStatus");
                _dbadapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                _dbadapter.SelectCommand.Connection = _dbconn;
                _dbadapter.SelectCommand.Parameters.Clear();
                _dbadapter.SelectCommand.Prepare();
                _dbadapter.Fill(_data);

                return _data;
            }
            catch (SqlException e)
            {
                throw new Exception("SQL Error: HRM_EMPLOYEE_GetStatus: " + e.Message, e);
            }
            finally
            {
                if (_dbadapter.SelectCommand != null)
                    _dbadapter.SelectCommand.Dispose();
                CloseConnection();
            }
        }




        
    }
}
